package com.dxysun.design.iterator;

import java.util.ArrayList;
import java.util.List;

public class ConcreteAggregate<E> implements IAggregate<E>
{
	private List<E> list;

	public ConcreteAggregate()
	{
		this.list = new ArrayList<>();
	}

	@Override
	public boolean add(E e)
	{
		return list.add(e);
	}

	@Override
	public boolean remove(E e)
	{
		return list.remove(e);
	}

	@Override
	public Iterator<E> iterator()
	{
		return new ConcreteIterator<>(list);
	}
}
